using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

namespace SpaceInvaders
{
  
    public class Game1 : Microsoft.Xna.Framework.Game
    {
        GraphicsDeviceManager graphics;
        SpriteBatch spriteBatch;

        Player player;
        Enemy enemy;

        public Game1()
        {
            graphics = new GraphicsDeviceManager(this);
            Content.RootDirectory = "Content";

            player = new Player(new Rectangle(0, 400, 50, 50));
           
        }

        protected override void Initialize()
        {
            IsMouseVisible = true;
            graphics.PreferredBackBufferHeight = 600;
            graphics.PreferredBackBufferWidth = 800;
            base.Initialize();
        }

        protected override void LoadContent()
        {
         
            spriteBatch = new SpriteBatch(GraphicsDevice);
            player.Load(Content);
            //enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(100, 10, 50, 50));
            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(200, 10, 50, 50));
            //enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(300, 10, 50, 50));
            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(400, 10, 50, 50));
            //enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(500, 10, 50, 50));

            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(100, 75, 50, 50));
            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(200, 75, 50, 50));
            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(300, 75, 50, 50));
            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(400, 75, 50, 50));
            enemy = new Enemy(Content.Load<Texture2D>("inimigo"), new Rectangle(500, 75, 50, 50));  
      
      
        }

        protected override void UnloadContent()
        {
           
        }

    
        protected override void Update(GameTime gameTime)
        {

            if (Keyboard.GetState().IsKeyDown(Keys.Escape)) 
                this.Exit();

            player.Update(gameTime);
            enemy.Update(gameTime);
          

            base.Update(gameTime);
        }

  
        protected override void Draw(GameTime gameTime)
        {
            GraphicsDevice.Clear(Color.Black);
          
            spriteBatch.Begin();
            
            player.Draw(spriteBatch);
            enemy.Draw(spriteBatch);

            spriteBatch.End();

            base.Draw(gameTime);
        }
    }
}
